package com.xiaobai.netease_news.fragments;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.xiaobai.netease_news.R;
import com.xiaobai.netease_news.adapters.MyPagerAdapter;
import com.xiaobai.netease_news.constants.Constant;
import com.xiaobai.netease_news.views.PagerSlidingTabStrip;

import java.util.LinkedList;
import java.util.List;

/**
 * A simple {@link Fragment} subclass.
 */
public class VaFragment extends Fragment {

    private final String[] TITLES = new String[]{"视频", "电台"};

    public VaFragment() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_va, container, false);

        List<Fragment> fragments = new LinkedList<>();


        VideoFragment videoFragment = new VideoFragment();
        Bundle args = new Bundle();
        args.putString(Constant.ARG_CONTENT_LIST_TYPE, Constant.VA_VIDEO);
        videoFragment.setArguments(args);
        fragments.add(videoFragment);

        RadioFragment radioFragment = new RadioFragment();
        VaListFragment vaListFragment = new VaListFragment();
        args = new Bundle();
        args.putString(Constant.ARG_CONTENT_LIST_TYPE, Constant.VA_VIDEO);
        vaListFragment.setArguments(args);
        fragments.add(radioFragment);

        MyPagerAdapter adapter = new MyPagerAdapter(getChildFragmentManager(), fragments, TITLES);

        ViewPager vaPager = (ViewPager) view.findViewById(R.id.video_pager);
        vaPager.setAdapter(adapter);

        PagerSlidingTabStrip pagerSlidingTabStrip = (PagerSlidingTabStrip) view.findViewById(R.id.video_pager_tab);
        pagerSlidingTabStrip.setTextSize(30);
        pagerSlidingTabStrip.setViewPager(vaPager);

        return view;
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
    }

    @Override
    public void onViewStateRestored(Bundle savedInstanceState) {
        super.onViewStateRestored(savedInstanceState);
    }

}
